﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Skywave.Data
{
    [DataContract]
    public enum SqlReportColumnDataTypes
    {
        [EnumMember]
        Integer = 1,
        [EnumMember]
        Double = 2,
        [EnumMember]
        Currency = 3,
        [EnumMember]
        String = 4,
        [EnumMember]
        DateTime = 5,
        [EnumMember]
        Boolean = 6,
        [EnumMember]
        ByteArray = 7,
        [EnumMember]
        TimeSpan = 8,
    }

    [DataContract]
    public class SqlReportColumn
    {
        public SqlReportColumn()
        {
            DataType = SqlReportColumnDataTypes.String;
            Tags = new Dictionary<string, string>();
            DataType_Currency_CultureInfo_Name = null;
            DataType_Currency_DecimalCount = null;
            Visible = true;
        }

        [DataMember]
        public string Id { get; set; }
        [DataMember]
        public string Text { get; set; }
        [DataMember]
        public SqlReportColumnDataTypes DataType { get; set; }
        [DataMember]
        public string DataType_Currency_CultureInfo_Name { get; set; }
        [DataMember]
        public int? DataType_Currency_DecimalCount { get; set; }
        [DataMember]
        public Dictionary<string, string> Tags { get; set; }
        [DataMember]
        public bool Visible { get; set; }

        public override string ToString()
        {
            return Text;
        }
        public override bool Equals(object obj)
        {
            if (obj is SqlReportColumn)
                return (obj as SqlReportColumn).Id.Equals(this.Id);
            else
                return false;
        }
        public override int GetHashCode()
        {
            return Id.GetHashCode();
        }
    }
}
